package io.change_stream;

import java.io.*;

public class Test {
    public static void main(String[] args) throws IOException {
        // 使用字符流输入/输出流指定编码,只能在jdk11之后,之前只能使用转换流指定编码
        method1();
//        OutputStreamWriter osw = new OutputStreamWriter(new FileOutputStream("AdvancedCode/src/io/change_stream/info.txt", true), "GBK");
//        osw.write("就算这次做错也只是怕错过");
//        osw.close();
    }

    private static void method1() throws IOException {
        InputStreamReader isr = new InputStreamReader(new FileInputStream("AdvancedCode/src/io/change_stream/info.txt"),"GBK");
        int ch;
        while ((ch = isr.read()) != -1){
            System.out.print((char)ch);
        }
        isr.close();
    }
}
